package com.whc.gulimall.ware.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.whc.gulimall.ware.entity.WareInfoEntity;
import com.whc.gulimall.ware.vo.WareStockMapVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 仓库信息
 *
 * @author wanghaochen
 * @email angaoen@outlook.com
 * @date 2022-03-05 00:09:03
 */
@Mapper
public interface WareInfoDao extends BaseMapper<WareInfoEntity> {

    /**
     * 获取到map key-skuId value-字符串形式的wareId，以，分隔
     *
     * @param collect
     * @return
     */
    List<WareStockMapVo> listHasStockWareBySkuIds(@Param("collect") List<Long> collect);

    /**
     * 锁库存
     *
     * @param skuId  skuId
     * @param count  商品数
     * @param wareId 库存id
     * @return
     */
    Integer lockSkuStock(@Param("skuId") Long skuId, @Param("count") Integer count, @Param("wareId") Long wareId);
}
